package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.SetMealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("mobile/setmeal")
@Slf4j
public class MobileSetMealController {
    @Autowired
    private SetMealService setMealService;

    @GetMapping("getSetmeal")
    public Result getSetmeal() {
        List<Setmeal> setmealList = setMealService.findAll();
        return new Result(true, MessageConst.QUERY_SETMEALLIST_SUCCESS,setmealList);
    }

    @GetMapping("findById")
    public Result findById(Integer id) {
        log.info("[手机端-预约详情]id:{}",id);
        Setmeal byId = setMealService.findById(id);
        return new Result(true, MessageConst.QUERY_SETMEALLIST_SUCCESS,byId);
    }
}
